﻿using LPLS.Commons.DBModule;
using LPLS.DBEntities;
using LPLS.DBEntities.ConfigModels.DataCollectionConfigModule.DataCollectionRuleEdgeModule;
using LPLS.DBInterface.ConfigModels.DataCollectionConfigModule.DataCollectionRuleEdgeModule;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LPLS.DBServices.ConfigModels.DataCollectionConfigModule.DataCollectionRuleEdgeModule
{
    public  class DataCollectionOPCUAConfigService : DBBaseService, IDataCollectionOPCUAConfigService
    {
        public DataCollectionOPCUAConfigService(DBContext dbContext) : base(dbContext)
        {
        }

        public int AddData(DataCollectionOPCUAConfig model)
        {
         return   this.Client.Insertable(model).ExecuteCommand();
        }

        public int DeleteData(DataCollectionOPCUAConfig model)
        {
           return this.Client.Deleteable(model).ExecuteCommand();
        }

        public List<DataCollectionOPCUAConfig> GetData()
        {
            return this.Client.Queryable<DataCollectionOPCUAConfig>().ToList();
        }

        public override void InitDataBaseName()
        {
            DataBaseName = DatabaseEnum.CollectionConfigDB.ToString();
        }

        public int UpdateData(DataCollectionOPCUAConfig model)
        {
           return this.Client.Updateable(model).ExecuteCommand();
        }
    }
}
